package cn.com.xyc.xml.testService;

import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import cn.com.xyc.xml.dao.HelloBean;

public class UserBean {
	private HelloBean helloBean;
	private String name;
	private List<String> city;
	private Set<String> names;
	private Map<String, Object> books;
	private Properties params;

	/**
	 * 测试创建时机
	 */
	public UserBean() {
		System.out.println("创建UserBean对象");
	}

	public UserBean(HelloBean helloBean, String name) {
		this.helloBean = helloBean;
		this.name = name;
	}

	public void myInit() {
		System.out.println("usreBean初始化");
	}

	public void myDestroy() {
		System.out.println("userBean销毁!释放资源");
	}

	public void show() {
		System.out.println("显示Hello消息");
		System.out.println(name);
		helloBean.sayHello();
	}

	public void showCollections() {
		for (String str : city) {
			System.out.println(str);
		}
		System.out.println("######################");
		for (String str : names) {
			System.out.println(str);
		}
		System.out.println("######################");
		Set<String> bookKey = books.keySet();
		for (String str : bookKey) {
			System.out.println(books.get(str));
		}
		System.out.println("######################");
		Set<Object> ids = params.keySet();
		for (Object id : ids) {
			System.out.println(params.getProperty(id.toString()));
		}
	}

	public HelloBean getHelloBean() {
		return helloBean;
	}

	public void setHelloBean(HelloBean helloBean) {
		this.helloBean = helloBean;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setCity(List<String> city) {
		this.city = city;
	}

	public void setNames(Set<String> names) {
		this.names = names;
	}

	public void setBooks(Map<String, Object> books) {
		this.books = books;
	}

	public void setParams(Properties params) {
		this.params = params;
	}

}
